package com.some.jobdescapp.model;

import android.support.annotation.NonNull;
import android.view.View;
import android.widget.TextView;

import com.randy.recyclerviews.adapter.UniversalAdapter;
import com.some.jobdescapp.R;
import com.some.jobdescapp.bean.ChildEntity;

/**
 * @author RANDY.ZHANG
 * @version 1.0
 * @company:
 * @date 2019/1/8 22:21
 */
public class ContentModel extends UniversalAdapter.AbstractModel<ContentModel.ViewHolder>{

    private ChildEntity childEntity;
    public ContentModel(ChildEntity childEntity) {
        this.childEntity = childEntity;
    }


    public ChildEntity getChildEntity() {
        return childEntity;
    }

    @Override
    public int getLayoutRes() {
        return R.layout.adapter_child;
    }

    @Override
    public void bindData(@NonNull ViewHolder holder) {
        super.bindData(holder);
        holder.textView.setText(childEntity.getContent());
    }

    @NonNull
    @Override
    public UniversalAdapter.IViewHolderCreator<ViewHolder> getViewHolderCreator() {
        return new UniversalAdapter.IViewHolderCreator<ViewHolder>() {
            @NonNull
            @Override
            public ViewHolder create(@NonNull View view) {
                return new ViewHolder(view);
            }
        };
    }

    public class ViewHolder extends UniversalAdapter.ViewHolder {
        private TextView textView;
        public ViewHolder(View itemView) {
            super(itemView);
            textView = itemView.findViewById(R.id.tv_child);
        }
    }
}
